package com.elem.service.impl;

import com.elem.bean.User;
import com.elem.dao.UserDao;
import com.elem.dao.impl.UserDaoImpl;
import com.elem.service.UserService;

public class UserServiceImpl implements UserService {
    // 创建UserDao对象
//    调用userDao层
    UserDao userDao = new UserDaoImpl();

    @Override
    public User getUserById(String userId) throws Exception {
//        获得当前的id，传递给Dao层
        User user = userDao.getUserById(userId);
        return user;
    }

    @Override
    public int saveUser(User user) throws Exception {
        int row = userDao.saveUser(user);
        return row;
    }

    @Override
    public User getUserByIdByPass(String userId, String password) throws Exception {
        //        获得当前的id，password，传递给Dao层
        User user = userDao.getUserByIdByPass(userId, password);
        return user;
    }
}
